import Vue from 'vue'
import App from './App'
import store from "./store/index.js";
Vue.prototype.$store = store;

import api_server from "@/api/api_server.js";
import util from "@/common/util.js";
Vue.prototype.$util = util;
Vue.prototype.$api_server = api_server;
Vue.config.productionTip = false

App.mpType = 'app'


Vue.prototype.upx2px = function(n) {
	return uni.upx2px(Number(n))
}
//颜色选择控件------
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom', cuCustom)
// Vue.mixin({
// 	computed: {
// 		themeColor() {
// 			return this.$store.getters.getThemeColor;
// 		}
// 	}
// })
//==---
//-----------异常捕获---
// const errorHandler = (err, vm, info) => {
// 	var data = {
// 		err: err,
// 		vm: vm,
// 		info: info
// 	};
// 	store.commit('setErroeList', data);
// }
// Vue.config.errorHandler = errorHandler;
// Vue.prototype.$throw = (error) => errorHandler(error, this);
//-----------异常捕获---

//小数点两位过滤器
Vue.filter('toFIex', function(num) {
	num = Number(num)
	if(!Number.isFinite(num)){
		num = 0.00 ;
	}
	return num.toFixed(2)
})

//时间格式
Vue.filter('yyyy_MM_dd', function(num) {
	if(Number.isFinite(num)){
		num = parseInt(num);
		num = new Date(num);
		num = num.getFullYear() + '-' + (num.getMonth() + 1) + '-' + num.getDate() +' '+num.getHours()+ ':' +num.getMinutes()+ ':' + num.getSeconds();
	}else{
		num = '未知时间';
	}
	return num;
})

const app = new Vue({
	...App
})
app.$mount()
